package cn.wolfcode.shop.cloud.mq;

import cn.wolfcode.shop.cloud.web.controller.SeckillOrderInfoController;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

@RocketMQMessageListener(
        consumerGroup = MQConstans.CREATE_ORDER_BROAD_GROUP,
        topic = MQConstans.CREATE_ORDER,
        selectorExpression = MQConstans.CREATE_ORDER_BROAD_TAG,
        //广播模式
        messageModel = MessageModel.BROADCASTING
)

@Component
public class OrderBroadMQListener implements RocketMQListener<Long> {


    @Override
    public void onMessage(Long goodId) {
        System.out.println("进入到广播队列中");
        SeckillOrderInfoController.local_flag.put(goodId,false);
    }
}
